<template>
    <div>
        <van-goods-action>
            <van-goods-action-icon icon="cart-o" text="购物车" :badge="goodsCount" />
            <van-goods-action-icon
                :icon="isCollected ?'star':'star-o'"
                :text="isCollected ?'已收藏':'收藏'"
                color="red"
                @click="isCollected = !isCollected"
            />
            <van-goods-action-button type="warning" text="加入购物车" @click="addToCart"/>
            <van-goods-action-button type="danger" text="立即购买" @click="handleClick"/>
        </van-goods-action>
    </div>
</template>

<script>
export default {
    data() {
        return {
            isCollected: false,
        };
    },
    props: ['goodsCount'],
    methods:{
        addToCart(){
            this.$emit("addToCart")
        },
        handleClick(){
            this.$emit('handlclick')
        },
    }
};
</script>
 
<style lang = "less" scoped>
.van-goods-action{
    z-index: 9999;
}
</style>